﻿@{ Layout = "../../Views/Shared/_LayoutPhone.cshtml";}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
</head>
<body>
    <div id="divlai" class="container mt-4 main-container">
        <div class="row">
            <div class="col-sm-12 col-md-12">
                <div class="card rounded-0 border-0 mb-3" style="margin-left: -10px; margin-right: -10px;">
                    <div class="card-header">
                        <div class="row">
                            <div class="col-8">
                                <h5 id="biaotiyindao">
                                </h5>
                                <h5 id="h5text" class="card-title mb-0">
                                </h5>
                            </div>

                        </div>
                    </div>
                    <div class="card-body">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th scope="col" style="width: 35%;text-align:center;">客户姓名</th>
                                    <th scope="col" style="text-align:center;">联系方式</th>
                                </tr>
                            </thead>
                            <tbody id="TableLaiFang" style="text-align:center;">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div style="margin-bottom: 50px;padding-bottom:1px"></div>
    <div id="shu"></div>
    <script>
        $(document).ready(function () {
            BindTodayGenJinJiLu();
        });
        function BindTodayGenJinJiLu() {
            $.ajax({
                type: "POST",
                url: "../PhoneKeHu/BindKeHuLeiXingLaiFang",
                cache: false,  //禁用缓存
                data: { "ZhuangTai": getQuery("ZhuangTai") },
                dataType: "Json",
                success: function (response) {
                    if (getQuery("ZhuangTai") == "已到访") {
                        $("#h5text").html("来访客户");
                        $("#biaotiyindao").val("来访客户");
                    }
                    if (getQuery("ZhuangTai") == "逾期") {
                        $("#h5text").html("逾期客户");
                        $("#biaotiyindao").val("逾期客户");
                    }
                    if (getQuery("ZhuangTai") == "未到访") {
                        $("#h5text").html("未到访客户");
                        $("#biaotiyindao").val("未到访客户");
                    }
                    if (getQuery("ZhuangTai") == "新分配") {
                        $("#h5text").html("新分配客户");
                        $("#biaotiyindao").val("新分配客户");
                    }
                    $(response).each(function (key) {
                        $("#TableLaiFang").append("<tr><td scope='row' style='text-align:center;'><a onclick='hrefToKeHuXiangXi(" + response[key].Id + ")'>" + response[key].KeHuXingMing + "</a></td><td>" + response[key].ShouJiHaoMa + "</td></tr>");
                    })
                }
            });
        }
        function hrefToKeHuXiangXi(id) {
            var zhi = "";
            if (getQuery("ZhuangTai") == "已到访") {
                zhi = "YiDaoFang";
            }
            if (getQuery("ZhuangTai") == "逾期") {
                zhi = "YuQi";
            }
            if (getQuery("ZhuangTai") == "未到访") {
                zhi = "WeiDaoFang";
            }
            if (getQuery("ZhuangTai") == "新分配") {
                zhi = "XinFenPei";
            }
            location.href = "KeHuXiangXi?KeHuId=" + id + "&LeiXing=" + zhi;
        }
        function getQuery(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]); return null;
        }
    </script>
</body>
</html>
